<%@ page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ page import="java.util.HashMap,java.util.Date" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<jsp:include page="header.jsp"/>
<table cellpadding="2" cellspacing="1" class="table_form">
	<caption>排序方式</caption>
	<tr>
		<td>
			<a href="${config.site_root}/admin?c=admin&a=manage&order=userid"<c:if test="${order eq 'userid'}"> style="color:red;"</c:if>>userid降序</a> |
			<a href="${config.site_root}/admin?c=admin&a=manage&order=lastvist"<c:if test="${order eq 'lastvist'}"> style="color:red;"</c:if>>登陆时间降序</a>
		</td>
	</tr>
</table>

<table align="center" cellpadding="0" cellspacing="1" class="table_list">
	<caption>管理员列表</caption>
	<tr>
		<th width="5%">userid</th>
		<th width="20%">管理员名称</th>
		<th>用户组</th>
		<th>强制QQ登陆</th>
		<th>自由账号</th>
		<th width="15%">最后登陆ip</th>
		<th width="10%">最后登陆地址</th>
		<th width="15%">最后登陆时间</th>
		<th>管理操作</th>
	</tr>
	
	<c:forEach items="${data.itemsList}" var="member">
	<c:set var="groupid" value="${member.groupid}" scope="request"/>
	<c:set var="lastvist" value="${member.lastvist}" scope="request"/>
	<tr>
		<td class="align_c">${member.userid}</td>
		<td class="align_c"><a href="">${member.username}</a></td>
		<td class="align_c" style="color:<c:choose><c:when test="${member.groupid eq 1}">green</c:when><c:otherwise>blue</c:otherwise></c:choose>;"><%=((HashMap)request.getAttribute("groups")).get(Integer.valueOf((String)request.getAttribute("groupid")))%></td>
		<td class="align_c"><c:choose><c:when test="${member.force_qq eq 1}">是</c:when><c:otherwise>否</c:otherwise></c:choose></td>
		<td class="align_c"><c:choose><c:when test="${member.isfree eq 1}">是</c:when><c:otherwise>否</c:otherwise></c:choose></td>
		<td class="align_c"><c:choose><c:when test="${!empty(member.ip)}">${member.ip}</c:when><c:otherwise>-</c:otherwise></c:choose></td>
		<td class="align_c"><c:choose><c:when test="${!empty(member.ip)}"><a href="http://www.ip138.com/ips138.asp?ip=${member.ip}" target="_blank">查看</a></c:when><c:otherwise>-</c:otherwise></c:choose></td>
		<td class="align_c"><c:choose><c:when test="${member.lastvist gt 0}"><fmt:formatDate value="<%=new Date(Long.valueOf((String)request.getAttribute(\"lastvist\"))*1000L)%>" pattern="yyyy-MM-dd kk:mm:ss"/></c:when><c:otherwise>-</c:otherwise></c:choose></td>
		<td class="align_c">
			<a href="${config.site_root}/admin?c=admin&a=manage&op=edit&userid=${member.userid}">修改</a> |
			<a href="javascript:deleteConfirm('${config.site_root}/admin?c=admin&a=manage&op=delete&userid=${member.userid}')">删除</a> |
			<a href="${config.site_root}/admin?c=admin&a=manage&op=stop&userid=${member.userid}&ip=${member.ip}&isstop=<c:choose><c:when test="${member.isstop eq 1}">0</c:when><c:otherwise>1</c:otherwise></c:choose>" title="禁用的同时会强制其退出后台"{/if}><c:choose><c:when test="${member.isstop eq 1}">启用</c:when><c:otherwise>禁用</c:otherwise></c:choose></a> |
			<a href="${config.site_root}/admin?c=admin&a=manage&op=exit&ip=${member.ip}" title="您可以先更改此用户密码再强制退出，使其不能再登陆后台">强制退出</a>
		</td>
	</tr>
	</c:forEach>
</table>
<div class="viciao" style="margin:5px 7px;">${data.pages}</div>
<jsp:include page="footer.jsp"/>
<script language="javascript">
function deleteConfirm(url) {
	if(window.confirm('确定删除管理员吗？')) {
		location.href = url;
	}
}
</script>